<cd-modal [modalRef]="activeModal">
  <ng-container class="modal-title"
                i18n>Discovery Authentication</ng-container>

  <ng-container class="modal-content">
    <form name="discoveryForm"
          #formDir="ngForm"
          [formGroup]="discoveryForm"
          novalidate>
      <div class="modal-body">
        <!-- User -->
        <div class="form-group row">
          <label class="cd-col-form-label"
                 for="user"
                 i18n>User</label>
          <div class="cd-col-form-input">
            <input id="user"
                   class="form-control"
                   formControlName="user"
                   type="text"
                   autocomplete="off">
            <span class="invalid-feedback"
                  *ngIf="discoveryForm.showError('user', formDir, 'required')"
                  i18n>This field is required.</span>

            <span class="invalid-feedback"
                  *ngIf="discoveryForm.showError('user', formDir, 'pattern')"
                  i18n>User names must have a length of 8 to 64 characters and can contain
              alphanumeric characters, '.', '@', '-', '_' or ':'.</span>
          </div>
        </div>

        <!-- Password -->
        <div class="form-group row">
          <label class="cd-col-form-label"
                 for="password"
                 i18n>Password</label>
          <div class="cd-col-form-input">
            <div class="input-group">
              <input id="password"
                     class="form-control"
                     formControlName="password"
                     type="password"
                     autocomplete="new-password">

              <span class="input-group-append">
                <button type="button"
                        class="btn btn-light"
                        cdPasswordButton="password">
                </button>
                <cd-copy-2-clipboard-button source="password">
                </cd-copy-2-clipboard-button>
              </span>
            </div>
            <span class="invalid-feedback"
                  *ngIf="discoveryForm.showError('password', formDir, 'required')"
                  i18n>This field is required.</span>

            <span class="invalid-feedback"
                  *ngIf="discoveryForm.showError('password', formDir, 'pattern')"
                  i18n>Passwords must have a length of 12 to 16 characters and can contain
              alphanumeric characters, '@', '-', '_' or '/'.</span>
          </div>
        </div>

        <!-- mutual_user -->
        <div class="form-group row">
          <label class="cd-col-form-label"
                 for="mutual_user">
            <ng-container i18n>Mutual User</ng-container>
          </label>
          <div class="cd-col-form-input">
            <input id="mutual_user"
                   class="form-control"
                   formControlName="mutual_user"
                   type="text"
                   autocomplete="off">

            <span class="invalid-feedback"
                  *ngIf="discoveryForm.showError('mutual_user', formDir, 'required')"
                  i18n>This field is required.</span>

            <span class="invalid-feedback"
                  *ngIf="discoveryForm.showError('mutual_user', formDir, 'pattern')"
                  i18n>User names must have a length of 8 to 64 characters and can contain
              alphanumeric characters, '.', '@', '-', '_' or ':'.</span>
          </div>
        </div>

        <!-- mutual_password -->
        <div class="form-group row">
          <label class="cd-col-form-label"
                 for="mutual_password"
                 i18n>Mutual Password</label>
          <div class="cd-col-form-input">
            <div class="input-group">
              <input id="mutual_password"
                     class="form-control"
                     formControlName="mutual_password"
                     type="password"
                     autocomplete="new-password">

              <span class="input-group-append">
                <button type="button"
                        class="btn btn-light"
                        cdPasswordButton="mutual_password">
                </button>
                <cd-copy-2-clipboard-button source="mutual_password">
                </cd-copy-2-clipboard-button>
              </span>
            </div>
            <span class="invalid-feedback"
                  *ngIf="discoveryForm.showError('mutual_password', formDir, 'required')"
                  i18n>This field is required.</span>

            <span class="invalid-feedback"
                  *ngIf="discoveryForm.showError('mutual_password', formDir, 'pattern')"
                  i18n>Passwords must have a length of 12 to 16 characters and can contain
              alphanumeric characters, '@', '-', '_' or '/'.</span>
          </div>
        </div>
      </div>

      <div class="modal-footer">
        <cd-form-button-panel (submitActionEvent)="submitAction()"
                              [form]="discoveryForm"
                              [showSubmit]="hasPermission"
                              [submitText]="actionLabels.SUBMIT"></cd-form-button-panel>
      </div>
    </form>
  </ng-container>
</cd-modal>
